package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.jpa.policy.impl.UUIDPolicy;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.List;


/**
 * 人员群组管理对象 MB_ERP_EQUIPMENT_PERSON_GROUP
 *
 * @author Cheng
 * @date 2023-06-28
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_PS_GROUP")
@Schema(description="人员群组")
public class EquipmentPersonGroup extends BaseEntity {

private static final long serialVersionUID=1L;


    @Id
    @Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_")
    @Schema(description = "主键")
    private String id;

    @Column(name = "GROUP_NAME_")
    @Schema(description = "群组名称")
    private String groupName;

    @Column(name = "GROUP_CODE_")
    @Schema(description = "群组编码")
    private String groupCode;

    @Column(name = "GROUP_CATEGORY_")
    @Schema(description = "群组类别")
    @Dict(dicCode = "ERP_EQUIPMENT_GROUP_CATEGORY")
    private String groupCategory;

    @Column(name = "ORG_CODE_")
    @Schema(description = "部门")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String orgCode;

    @Column(name = "DIRECTOR_ID_")
    @Schema(description = "主管")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String directorId;

    @Column(name = "FACTORY_")
    @Schema(description = "厂区")
    @Dict(dicCode = "ERP_EQUIPMENT_FACTORY")
    private String factory;

    @Column(name = "IS_ENABLE_")
    @Schema(description = "是否启用")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isEnable;

    @Column(name = "REMARKS_")
    @Schema(description = "备注")
    private String remarks;

    @Column(name = "WORK_SHIFT_")
    @Schema(description = "班次")
    @Dict(dicCode = "ERP_EQUIPMENT_GROUP_WORKSHIFT")
    private String workShift;

    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
    @DateTimeFormat(pattern="HH:mm:ss")
    @Schema(description = "上班时间")
    @Column(name = "WORK_TIME_")
    private java.util.Date workTime;

    @JsonFormat(timezone = "GMT+8",pattern = "HH:mm:ss")
    @DateTimeFormat(pattern="HH:mm:ss")
    @Schema(description = "下班时间")
    @Column(name = "OFF_TIME_")
    private java.util.Date offTime;

    @Column(name = "GROUP_TEL_")
    @Schema(description = "群组电话")
    private String groupTel;

    @Transient
    private List<EquipmentPersonGroupDetail> personGroupDetails;

}
